<template>
	<view class="content">
		<view class="title">
			用户, 欢迎！
		</view>
		<view class="row-type" :class="typeIndex==0?'active':''" @click="typeClick(0)">
			<image v-if="typeIndex==0"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/537617dd-bdca-46f0-9c72-b00270d47a24.png">
			</image>
			<image v-else
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/81bb178f-086c-4e08-9d6a-cc41d55332c9.png">
			</image>
			<text>手机号注册</text>
		</view>
		<view class="row-type" :class="typeIndex==1?'active':''" @click="typeClick(1)">
			<image v-if="typeIndex==1"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/18ecc1be-7ae5-4cf2-8d6a-119734686c6d.png">
			</image>
			<image v-else
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/c26ac762-a9dd-4191-95b3-6fdec10e517a.png">
			</image>
			<text>邮箱注册</text>
		</view>
		<text class="other" @click="gotoLogin">我直接登录</text>
		<view class="row-input">
			<input :placeholder="typeIndex==0?'手机号':'邮箱'" :maxlength="typeIndex==0?11:18"
				placeholder-style="color:#b0b3bf" />
			<image mode="aspectFit"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/5849e0b1-ebcd-4bb0-a7ea-0f6e31f151ba.png">
			</image>
		</view>
		<view class="row-input">
			<input placeholder="验证码" maxlength="6" placeholder-style="color:#b0b3bf" />
			<image mode="aspectFit"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/5849e0b1-ebcd-4bb0-a7ea-0f6e31f151ba.png">
			</image>
		</view>
		<view class="row-input">
			<input placeholder="密码" :password="showPassword" maxlength="18" placeholder-style="color:#b0b3bf" />
			<image mode="aspectFit" v-if="!showPassword" @click="passwordChange"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/d71d8e65-7430-439f-9c30-f71357a77078.png">
			</image>
			<image mode="aspectFit" v-else @click="passwordChange"
				src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-a1714171-183a-4753-b538-8fabcab0d8b6/30cedf87-412d-4f98-923a-421eb7f0a166.png">
			</image>
		</view>
		<view class="agreement">
			<view>
				我同意
				<text class="link">《此协议》</text>
			</view>
			<checkbox :checked="false" style="transform: scale(0.7);" />
		</view>
		<view class="register-btn">
			注册
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				typeIndex: 0,
				showPassword: false,
			}
		},
		methods: {
			// 类型切换
			typeClick(id) {
				this.typeIndex = id
			},

			// 去登录
			gotoLogin() {
				uni.navigateTo({
					url: '/pages/login10/login'
				})
			},

			// 密码图标切换
			passwordChange() {
				this.showPassword = !this.showPassword
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 0 40rpx;
	}

	.title {
		display: flex;
		justify-content: center;
		align-items: flex-end;
		padding-bottom: 20rpx;
		font-size: 50rpx;
		font-weight: bold;
		color: #4a4a4a;
	}

	.row-type {
		margin: 30rpx 0;
		padding: 0 60rpx;
		height: 110rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		border: 1rpx solid #f6f6f6;
		font-size: 24rpx;
		border-radius: 25rpx;
		color: #dee1f2;

		image {
			width: 40rpx;
			height: 40rpx;
		}

		text {
			padding-left: 80rpx;
		}
	}

	.active {
		background-color: #7584cb;
	}

	.other {
		display: flex;
		justify-content: center;
		line-height: 100rpx;
		color: #b0b3bf;
		font-size: 26rpx;
	}

	.row-input {
		padding: 0 40rpx;
		margin: 30rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 110rpx;
		background-color: #f2f3f6;
		border-radius: 8rpx;
		font-size: 30rpx;

		image {
			width: 40rpx;
			height: 40rpx;
		}
	}

	.agreement {
		padding-left: 10rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 26rpx;
		font-weight: bold;
		color: #939393;

		text {
			color: #a6afda;
		}
	}

	.register-btn {
		margin-top: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #FFFFFF;
		height: 110rpx;
		background: linear-gradient(to right, #8d96fb, #7e86e1);
		letter-spacing: 5rpx;
		font-size: 30rpx;
		border-radius: 25rpx;
	}
</style>
